<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>

<html:html lang="true">

    <body>
        <table border="1">
            <tr>
                <td><bean:message key="tabela.arquivo" /></td>
                <td><bean:message key="tabela.usuario" /></td>
                <td><bean:message key="tabela.descricao" /></td>
                <td colspan="3"></td>
            </tr>
            <logic:iterate name="DocumentoForm" property="listaDocumentos" id="doc">
                <tr>
                    <td>
                        <bean:write name="doc" property="nomeDocumento" />
                    </td>
                    <td>
                        <bean:write name="doc" property="usuario.nome" />
                    </td>
                    <td>
                        <bean:write name="doc" property="descricao" />
                    </td>
                    <td>
                        <!-- Download do arquivo feito com Servlet -->
                        <html:link page="/DownloadServlet" paramId="codigoDocumento"
                                   paramName="doc" paramProperty="codigo">
                            <bean:message key="tabela.download" />
                        </html:link>
                    </td>
                    <td>
                        <html:link page="/alterarDocumento.do?method=exibirFormAlterar" paramId="codigoDocumento"
                                   paramName="doc" paramProperty="codigo">
                            <bean:message key="form.alterar" />
                        </html:link>
                    </td>
                    <td>
                        <html:link page="/listar.do?method=excluir" paramId="codigoDocumento"
                                   paramName="doc" paramProperty="codigo">
                            <bean:message key="form.excluir" />
                        </html:link>
                    </td>
                </tr>
            </logic:iterate>
            <logic:equal name="DocumentoForm" property="tamanhoLista" value="0">
                <tr>
                    <td colspan="6"><bean:message key="tabela.nenhumDocumento" /></td>
                </tr>
            </logic:equal>
        </table>
        <br />

        <html:link page="/novoDocumento.do?method=novoDocumento">
            <bean:message key="form.novoDocumento" />
        </html:link>
 
    </body>
    
</html:html>
      